<script>
export default {
  components: {},
  name: "",
  data() {
    return {
      resDate: ["2024-08-11", "2024-08-12", "2024-08-22"],
    };
  },
  computed: {},
  props: {},
  setup() {},
  methods: {
    getTime(time) {
      const y = time.getFullYear();
      const m =
        time.getMonth() < 9 ? `0${time.getMonth() + 1}` : time.getMonth() + 1;
      const d = time.getDate() < 10 ? `0${time.getDate()}` : time.getDate();

      const str = `${y}-${m}-${d}`;
      return str;
    },
    setCheck(data) {
      let nowDay = this.getTime(new Date());
      if (this.resDate.includes(data.day)) {
        return "dayYuan dayActive";
      } else if (nowDay === data.day) {
        return "dayYuan dayActiveOp";
      } else {
        return "dayYuan";
      }
    },
  },
  mounted() {},
  created() {},
};
</script>
<template>
  <div class="calendarCont">
    <div class="calendarTitle">日历待办事项</div>
    <el-calendar>
      <template #date-cell="{ data }">
        <div class="dayItem">
          <div :class="setCheck(data)">
            {{ data.day.split("-")[2] }}
          </div>
        </div>
      </template>
    </el-calendar>
  </div>
</template>
<style scoped lang="less">
.calendarCont {
  padding: 15px 20px;
  box-sizing: border-box;
  .calendarTitle {
    text-align: center;
    // color: #fff;
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 15px;
  }
  .dayItem {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    .dayYuan {
      width: 34px;
      text-align: center;
      line-height: 34px;
      height: 34px;
      border-radius: 50%;
    }
    .dayActive {
      background-color: #4b58dc;
      color: #fff;
    }
    .dayActiveOp {
      background-color: #b0b7ff;
      color: #fff;
    }
  }
}
</style>
<style>
.el-calendar-table .el-calendar-day {
  height: 50px;
  padding: 0;
}
.el-calendar {
  border-radius: 10px;
  overflow: hidden;
}
.el-calendar {
  --el-calendar-border: none;
  --el-calendar-selected-bg-color: #ffffff;
}
.el-calendar .el-button--small {
  height: 34px;
  color: #666;
  padding: 5px 15px;
}
</style>
